package com.example.spring.multi.basic.design.singleton;

/**
 * @author tomato
 * @ClassName Singleton2
 * @description: 内部类持有静态对象的方式实现单例
 * @date 2023年07月08日 9:44
 * @version: 1.0
 */
public class Singleton2 {
    private Singleton2() {
    }

    private static class SingletonHolder {
        private static final Singleton2 INSTANCE = new Singleton2();
    }

    public static Singleton2 getInstance() {
        return SingletonHolder.INSTANCE;
    }
}
